package com.mxnavi.smartd.sdk.database;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

import com.mxnavi.smartd.sdk.bean.UserCarDriveRecord;
import com.mxnavi.smartd.sdk.database.dao.UserCarDriveRecordDao;

/**
 * @author ：zhong.jw
 * @date ：Created in 2024/2/22 15:00
 */
@Database(entities = {UserCarDriveRecord.class}, version = 1)
public abstract class SmartDDataBase extends RoomDatabase {
    private static final String TAG = "SmartDDataBase";

    public static final String DATE_BASE_NAME = "smartd_data_base";

    private static volatile SmartDDataBase INSTANCE;

    public static SmartDDataBase getInstance(Context context) {
        if (INSTANCE == null) {
            synchronized (SmartDDataBase.class) {
                if (INSTANCE == null) {
                    INSTANCE = Room.databaseBuilder(context.getApplicationContext(), SmartDDataBase.class, DATE_BASE_NAME).build();
                }
            }
        }
        return INSTANCE;
    }

    public abstract UserCarDriveRecordDao getUserCarDriveRecordDao();
}
